/*search模块管理仓库 
  namespaced写法，每项单独写
*/
import { reqSearchList } from "@/api";
const actions = {
  async getSearchList({ commit }, param = {}) {
    let result = await reqSearchList(param);
    //console.log("getSearchList", result);
    if (result.code === 200) {
      commit("SETSEARCHLIST", result.data);
    }
  },
};
const mutations = {
  SETSEARCHLIST(state, value) {
    state.searchList = value;
  },
};
const state = {
  searchList: {} || [],
};
const getters = {
  //简化仓库中的数据(类似计算属性)
  goodsList(state) {
    return state.searchList.goodsList;
  },

  attrsList(state) {
    return state.searchList.attrsList;
  },

  trademarkList(state) {
    return state.searchList.trademarkList;
  },
}; //类似于计算属性
export default {
  namespaced: true,
  actions,
  mutations,
  state,
  getters,
};
